package day04;

import java.util.Random;
import java.util.Scanner;

public class GussessingDemo {
    public static void main(String[] args) {
        //        生成一个随机数
        int num = new Random().nextInt(10000);
        System.out.println(num);
        Scanner scanner=new Scanner(System.in);
        System.out.println("输入要猜的数字：");
        int guess = scanner.nextInt();
        while (num!=guess){
            if (num>guess){
                System.out.println("猜小了");
            }else {
                System.out.println("猜大了");
            }
            System.out.println("输入要猜的数字：");
            guess=scanner.nextInt();
        }
        System.out.println("恭喜你，猜对了");

    }
}
